class Solution:
    def hIndex(self, citations: list) -> int:
        """反正我觉得测试用例是神经病"""
        citations.sort(reverse=True)
        for i in range(len(citations)):
            if citations[i] == i + 1:
                return i + 1
        return 0


class Solution:
    def hIndex(self, citations: list) -> int:
        res, length = 0, 0
        citations.sort(reverse=True)
        for i in citations:
            if i > res:
                length += 1
                res = min(length, i)
        return res


a = Solution()
print(a.hIndex([3, 0, 6, 1, 5]))
print(a.hIndex([]))
